﻿@using GSLMS.WebAPP
@model GSLMS.Entity.TB_LOAN_CONTRACT
@{
    Layout = null;
    var ddlLendorCorp = ViewData["LendorCorp"] as SelectList;
    var ddlFinalApprover = ViewData["FinalApprover"] as SelectList;
    var LoanMainCust = Model.LoanMainCust ?? new List<GSLMS.Entity.TB_LOAN_MAINCUST>();
    var LoanMainCorp = Model.LoanMainCorp ?? new List<GSLMS.Entity.TB_LOAN_MAINCORP>();
    Model.ProInfo = Model.ProInfo ?? new GSLMS.Entity.TB_APP_PROINFO();
    Model.ProInfo.ProComInfo = Model.ProInfo.ProComInfo ?? new GSLMS.Entity.TB_APP_PROCOMINFO();
    Model.LoanMain = Model.LoanMain ?? new GSLMS.Entity.TB_LOAN_MAIN();
}
<div class="pageContent">
    <form method="post" id="formLoanCreate" action="DianDang/FKApply/Loaning/Create?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return validateCallback(this, dialogAjaxDone)">
    @Html.ValidationSummary(true)
    <div class="pageFormContent" layouth="56">
        @Html.HiddenFor(model => model.ID)
        @Html.Hidden("hidActiondo")
        <p>
            <label>
                申请编号：</label>
            <a href='DianDang/Apply/ProInfo/Details/@Model.PROID?OpID=@ViewData["OperateID"]&actiondo=view' target="dialog" rel="divQueryLoaning" class="">
                @Html.ValueFor(c => c.APPLYID)</a>
        </p>
        <p>
            <label>
                贷款号：</label>
            @Html.ValueFor(model => model.LoanNo)
        </p>
        <p>
            <label>
                申请人：</label>
            @Html.ValueFor(model => model.LastApplyBy)
        </p>
        <p>
            <label>
                申请日期：</label>
            <span formatedate="yyyy-MM-dd">@Html.ValueFor(model => model.APPLYDATE)</span>
        </p>
        <p>
            <label>
                项目类别：</label>
            @((GSLMS.Entity.Enum.ApplyEnum.RegBussType)Model.ProInfo.BUSSTYPE)
        </p>
        <div class="divider" />
        <div class="title" style="margin-right: 10px">
            <h4>
                项目详情</h4>
            <p>
                <label>
                    借款方：</label>
                @Html.TextBoxFor(model => model.ProInfo.CUSTNAME, new { @class = "", @readonly = "true" })
                @Html.ValidationMessageFor(model => model.ProInfo.CUSTNAME)
            </p>
            <p>
                <label>
                    项目地址：</label>
                @Html.TextBoxFor(model => model.ProInfo.ProUnForHouInfo.CORPADDRESS, new { @class = "" ,@style="width:220px"})
                @Html.ValidationMessageFor(model => model.ProInfo.ProUnForHouInfo.CORPADDRESS)
            </p>
            <p>
                <label>
                    贷款金额：</label>
                @Html.TextBoxFor(model => model.ProInfo.AMOUNT, new { @class = "number" })
                @Html.ValidationMessageFor(model => model.ProInfo.AMOUNT)
            </p>
            <p>
                <label>
                    贷款期限：</label>
                @Html.ValueFor(model => model.ProInfo.ProComInfo.LOANTIME)
                @(Model.ProInfo.ProComInfo.LOANPHASE == 0 ? "天" : "月")
            </p>
            <p>
                <label>
                    手续费率：</label>
                @Html.ValueFor(model => model.ProInfo.LOANFEE)
            </p>
            <p>
                <label>
                    利率：</label>
                @Html.ValueFor(model => model.ProInfo.ProComInfo.RATE)
            </p>
            <p>
                <label>
                    顾问费率：</label>
                @Html.ValueFor(model => model.ProInfo.ProComInfo.MANAGERATE)
            </p>
        </div>
        <div class="divider" />
        <div class="title">
            <h4>
                经办人</h4>
            <p>
                <label>
                    推介人：</label>
                @Html.TextBoxFor(model => model.ProInfo.MEDIATOR, new { @class = "" })
                @Html.ValidationMessageFor(model => model.ProInfo.MEDIATOR)
            </p>
            <p>
                <label>
                    推介人账号：</label>
                @Html.TextBoxFor(model => model.ProInfo.MEDIATORACCOUNT, new { @class = "" })
                @Html.ValidationMessageFor(model => model.ProInfo.MEDIATORACCOUNT)
            </p>
            <p>
                <label>
                    项目经理：</label>
                @Html.ValueFor(model => model.ProInfo.SALESMAN)
            </p>
            <p>
                <label>
                    风控经理：</label>
                @Html.ValueFor(model => model.ProInfo.ProComInfo.LOANTIME)
            </p>
            <p>
                <label>
                    出借人：</label>
                @Html.TextBoxFor(model => model.LoanMain.LENDER, new { @class = "" })
                @Html.ValidationMessageFor(model => model.LoanMain.LENDER)
            </p>
            <p>
                <label>
                    顾问公司：</label>
                @Html.DropDownListFor(model => model.LoanMain.LENDORCORP, ddlLendorCorp, new { @class = "combox" })
            </p>
            <p style="width: 95%; height: 80px;">
                <label>
                    风控措施落实情况：</label>
                @Html.TextAreaFor(model => model.LoanMain.RISKSTEP, new { @cols = "70", @rows = "5", @maxlangth = "500" })
                @Html.ValidationMessageFor(model => model.LoanMain.RISKSTEP)
            </p>
            <p style="width: 95%; height: 80px;">
                <label>
                    特别备注：</label>
                @Html.TextAreaFor(model => model.LoanMain.SPECAILREMARK, new { @cols = "70", @rows = "5", @maxlangth = "200" })
                @Html.ValidationMessageFor(model => model.LoanMain.SPECAILREMARK)
            </p>
        </div>
        <div class="divider" />
        <div class="title">
            <h4>
                银行信息</h4>
            <p>
                <label>
                    出款时间：</label>
                @Html.TextBoxFor(model => model.LoanMain.LOANDATE, new { @class = "" })
                @Html.ValidationMessageFor(model => model.LoanMain.LOANDATE)
            </p>
            <p>
                <label>
                    已预收费用：</label>
                @Html.CheckBox("LoanMain.RecCharges", Model.LoanMain.RECCHARGES == 1, new { @class = "" })
                <span><a href='DianDang/Apply/ProInfo/Details/@Model.PROID?OpID=@ViewData["OperateID"]&actiondo=view' target="dialog" rel="divQueryLoaning" class="">
                    查看详情</a></span>
            </p>
            <p>
                <label>
                    放款中抵扣手续费：</label>
                @(Model.LoanMain.ISDEDUCTION == 0 ? "否" : "是")
                <dt>@Html.RadioButtonFor(model => model.LoanMain.ISDEDUCTION, 0)否</dt>
                <dt>@Html.RadioButtonFor(model => model.LoanMain.ISDEDUCTION, 1) 是</dt>
            </p>
            <p>
                <label>
                    放款中抵扣费用：</label>
                @Html.TextBoxFor(model => model.LoanMain.DEDFEES, new { @class = "" })
                @Html.ValidationMessageFor(model => model.LoanMain.DEDFEES)
            </p>
            <p>
                <label>
                    实际放款额：</label>
                @Html.TextBoxFor(model => model.LoanMain.ACTAMT, new { @class = "number" })
                @Html.ValidationMessageFor(model => model.LoanMain.ACTAMT)
            </p>
        </div>
        <div class="divider" />
        <div class="title">
            <h4>
                客户收款信息</h4>
            <div class="divider" />
            <table class="list nowrap itemDetail" addbutton="新建行" width="90%">
                <thead>
                    <tr>
                        <th type="text" name="LoanMainCust[#index#].BankName" size="12" fieldclass="required">
                            收款银行
                        </th>
                        <th type="text" name="LoanMainCust[#index#].AccountName" size="12" fieldclass="required">
                            收款人
                        </th>
                        <th type="text" name="LoanMainCust[#index#].AccountNo" size="12" fieldclass="required">
                            收款账户
                        </th>
                        <th type="text" name="LoanMainCust[#index#].Amt" size="12" fieldclass="required number">
                            收款额
                        </th>
                        <th type="del" width="60">
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in LoanMainCust)
                    { 
                        <tr>
                            <td>@Html.TextBox("LoanMainCust[#index#].Name", item.BANKNAME, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCust[#index#].ADDRESS", item.ACCOUNTNAME, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCust[#index#].TEL", item.ACCOUNTNO, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCust[#index#].FUNDED", item.AMT, new { @style = "width:100px" })
                            </td>
                            <th type="del" width="60">
                                操作
                            </th>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
        <div class="divider" />
        <div class="title">
            <h4>
                公司放款信息</h4>
            <div class="divider" />
            <table class="list nowrap itemDetail" addbutton="新建行" width="90%">
                <thead>
                    <tr>
                        <th type="text" name="LoanMainCorp[#index#].BankName" size="12" fieldclass="required">
                            放款银行
                        </th>
                        <th type="text" name="LoanMainCorp[#index#].AccountName" size="12" fieldclass="required">
                            放款账户名称
                        </th>
                        <th type="text" name="LoanMainCorp[#index#].AccountNo" size="12" fieldclass="required">
                            放款账户
                        </th>
                        <th type="text" name="LoanMainCorp[#index#].Amt" size="12" fieldclass="required number">
                            放款额
                        </th>
                        <th type="del" width="60">
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in LoanMainCorp)
                    { 
                        <tr>
                            <td>@Html.TextBox("LoanMainCorp[#index#].Name", item.BANKNAME, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCorp[#index#].ADDRESS", item.ACCOUNTNAME, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCorp[#index#].TEL", item.ACCOUNTNO, new { @style = "width:100px" })
                            </td>
                            <td>@Html.TextBox("LoanMainCorp[#index#].FUNDED", item.AMT, new { @style = "width:100px" })
                            </td>
                            <th type="del" width="60">
                                操作
                            </th>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
        <div class="divider" />
        <p>
            <label>
                财务复核人：</label>
            @Html.ValueFor(model => model.LoanMain.CHECKBY)
        </p>
        <p>
            <label>
                复核日期:</label>
            <span formatedate="yyyy-MM-dd">@Model.LoanMain.CHECKDATE</span>
        </p>
        <p style="width: 90%; height: 80px;">
            <label>
                备注:</label>
            @Html.TextAreaFor(model => model.REMARK, new { @cols = "70", @rows = "5", @maxlength = "400" })
            @Html.ValidationMessageFor(model => model.REMARK)
        </p>
        <p>
            <label>
                提交到：</label>
            @Html.DropDownList("toUser", ddlFinalApprover, new { @class = "combox", @selectedvalue = Model.TOUSER })
            @Html.Hidden("hidActiondo")
        </p>
    </div>
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="button" onclick="LoanCreate(0)">
                            保存</button></div>
                </div>
            </li>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="button" onclick="LoanCreate(1)">
                            提交</button></div>
                </div>
            </li>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="button" onclick="LoanCreate(2)">
                            退回</button></div>
                </div>
            </li>
        </ul>
    </div>
    </form>
</div>
<script>
    function LoanCreate(action) {
        $form = $("#formLoanCreate");
        $("#hidActiondo", $form).val(action);
        if (action == 2) {
            $.pdialog.close("DianDang_FKApply_Loaning_1");
            $.pdialog.open('DianDang/FKApply/Loaning/BackTo/@ViewData["ProID"]', "BackTo", "输入退回原因", { width: 500, height: 350 });
        }
        else {
            validateCallback($form, dialogAjaxDone);
        }
    }
</script>
